﻿using System;
using UnityEngine;
using UnityEngine.UI;

namespace JQMergeFramework
{
    public class UIOver: MonoBehaviour
    {
        public Text useTips;
        
        private void Start()
        {
            UIManager.Instance.AddBtnListener(this.transform);
        }

        
        void OnBtnClick(Transform trans)
        {
            AudioManager.Instance.Play(AudioName.Click);
            
            switch (trans.name)
            {
                case "BtnRemove":
                    //清除
                    MergeManager.Instance.DesHalfCity();
                    Close();
                    break;
                case "BtnClose":
                    Close();
                    UIManager.Instance.GetWindow<UIFailTip>().Open();
                    break;
            }
        }
        
        
        
        public void Open()
        {
            GetComponent<UIPopAnimate>().PopStart();
            useTips.text = "/(ToT)/~~是否立即清除\n棋盘一半最低等级的建筑？";
        }
        
        void Close()
        {
            GetComponent<UIPopAnimate>().PopEnd(); 
        }
        
    }
}